<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/27 0027
 * Time: 上午 11:34
 */

namespace App\Http\Classes;


use Illuminate\Support\Facades\Redis;

class RedisCache
{
    public static function setUserInfo($userId,$userInfo){
        Redis::set('u'.$userId,json_encode($userInfo));
        Redis::expire('u'.$userId,60*60*24*7);
    }

    public static function isUserExists($userId){
        return Redis::exists('u'.$userId);
    }

    public static function getUserInfo($userId){
        return json_decode(Redis::get('u'.$userId));
    }
}